package com.hzhjhh.view.cashierView;

import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import com.hzhjhh.init.dialog.Mytable;
import com.hzhjhh.view.cashierView.constant.ShowConstants;

/**
 * 组件初始化-收银页面-删除商品
 * @author 12083
 *
 */
public class DelMerchandiseInit {

	/**
	 * 初始化删除商品-按钮
	 */
	public static JButton initBt(VenditionDialog venditionDialog) {
		JButton delMerchandise = new JButton();
		delMerchandise.setBounds(436, 489, 96, 25);
		delMerchandise.setText("删除商品");
		delMerchandise.addActionListener(event -> {
			JTable jTable = venditionDialog.getJTable1();
			Vector colnames4 = venditionDialog.getRowDatas();
			JScrollPane jScrollPane = venditionDialog.getJScrollPane1();
			int row = jTable.getSelectedRow();
			colnames4.remove(row);
			jScrollPane.getViewport().add(
				Mytable.maketable(colnames4, ShowConstants.MERCHANDISE_HEAD) // 显示内容
			); // 把表装入容器
		});
		return delMerchandise;
	}
}
